package com.edu.service.impl;

import com.edu.bean.Goods;
import com.edu.bean.Page;
import com.edu.dao.GoodsDao;
import com.edu.dao.impl.GoodsDaoImpl;
import com.edu.service.GoodsService;

import java.util.List;

/**
 *@Auther:zzp
 *@Date:2025/9/19-15:15:37
 */
public class GoodsServiceImpl implements GoodsService {

    GoodsDao goodsDao = new GoodsDaoImpl();

    @Override
    public Page<Goods> getAllGoods(int pageNum, int pageSize) {
        List<Goods> goodsList = goodsDao.selectAllGoods(pageNum, pageSize);
        int rows = goodsDao.selectAllGoodsNum();
        Page<Goods> page = new Page(goodsList,pageNum,pageSize,rows);
        return page;
    }

    @Override
    public int deleteGoodById(int goodId) {
        return goodsDao.deleteGoodById(goodId);
    }

}
